#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

struct data { int da, p; };

int const maxn = 122;
int const maxm = 3001;
int f[maxn][maxm];
bool face[maxn][maxm+1]; //face up true
bool part[maxn][maxm+1]; //part 0 true
int pre[maxn][maxm+1];
vector<data> da;
int k, sum;

struct cmpclass { bool operator()(data a, data b) { return a.da > b.da; } } cmp;

int main()
{
	ios::sync_with_stdio(false);
	cin >> k;
	da.resize(3*k);
	for (int i = 0; i < 3*k; i++) {
		cin >> da[i].da;
		da[i].p = i+1;
		sum += da[i].da;
	}
	sort(da.begin(), da.end(), cmp);
	f[0][da[0].da] = true; face[0][da[0].da] = true; part[0][da[0].da] = true;
	for (int i = 1; i < 2*k; i++) {
		int tmp = da[i].da;
		for (int j = 0; j <= maxm; j++) {
			if (j+tmp <= maxm && f[i-1][j+tmp]) {
				f[i][j] = true;
				face[i][j] = face[i-1][j+tmp];
				part[i][j] = !face[i][j];
				pre[i][j]  = j+tmp;
			} else
			if (tmp >= j && f[i-1][tmp-j]) {
				f[i][j] = true;
				face[i][j] = !face[i-1][tmp-j];
				part[i][j] = face[i][j];
				pre[i][j] = tmp-j;
			} else
			if (j >= tmp && f[i-1][j-tmp]) {
				f[i][j] = true;
				face[i][j] = face[i-1][j-tmp];
				part[i][j] = face[i][j];
				pre[i][j] = j-tmp;
			}
		}
	}
	int d = 0;
	for (; d <= maxm; d++)
		if (f[2*k-1][d]) break;
	vector<vector<int> > ans;
	ans.resize(3);
	for (int i = 2*k; i < 3*k; i++) ans[2].push_back(da[i].p);
	for (int i = 2*k-1; i >= 0; i--) {
		ans[!part[i][d]].push_back(da[i].p);
		d = pre[i][d];
	}
	if ((int)ans[0].size() > k) {
		int l = ans[0].size();
		for (int i = 0; i < l - k; i++) {
			ans[1].push_back(ans[0][i]);
			ans[0][i] = ans[0][l-i-1];
		}
	} else
	if ((int)ans[1].size() > k) {
		int l = ans[1].size();
		for (int i = 0; i < l - k; i++) {
			ans[0].push_back(ans[1][i]);
			ans[1][i] = ans[1][l-i-1];
		}
	}
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < k; j++) cout << ans[i][j] << "\n";
}

